function toMatch(){
	window.location.href="../html/match.html"
}
function toMessage(){
	window.location.href="../html/Message.html"
}
$("#gorealname").click(function(){
	window.location.href="../html/realname.html"
})
$(".core").click(function(){
	window.location.href="../html/core.html"
})
$("#myTicket").click(function(){
	window.location.href="../html/myTicket.html"
})
$("#payTicket").click(function(){
	window.location.href="../html/payTicket.html"
})
$("#address").click(function(){
	window.location.href="../html/address.html"
})
$("#myBao").click(function(){
	window.location.href="../html/myBao.html"
})
$("#myOrder").click(function(){
	window.location.href="../html/orderList.html"
})
$("#myMatch").click(function(){
	window.location.href="../html/myMatch.html"
})
$("#myRole").click(function(){
	window.location.href="../html/myRole.html"
})
$("#feedback").click(function(){
	window.location.href="../html/feedback.html"
})
$("#task").click(function(){
	window.location.href="../html/task.html"
})
$("#tg").click(function(){
	window.location.href="../html/type.html"
})
$("#userRule").click(function(){
	window.location.href="../html/userRule.html"
})
$("#close").click(function(){
	$(".poster").css("display","none");
})
$("#KF").click(function(){
	$(".poster").css("display","flex");
})
$(function(){
	$.ajax({
		url:'../nameController/getRules',
		success:function(data){
			console.log(data);
			$(".posterBox img").attr("src",data.card)
		}
	})
})

$(function(){
	$.ajax({
		url:'../userController/getUser',
		success:function(data){
			console.log(data);
			$(".nickname").html(data.wx_name)
			if(data.identity=="平台推广"){
				$(".sfx").html(data.rank)
			}else{
				$(".sfx").html(data.identity)
			}
			/*$(".yqm").html('邀请码:'+data.remark)*/
			if(data.identity=="普通玩家"){
				$(".tg").css("display","flex")
				$(".core").css("display","none");
			}else{
				$(".tg").css("display","none")
				$(".core").css("display","block");
			}
			$("#balance").html(data.balance)
			$("#accumulated_amount").html(data.accumulated_amount)
			$("#count").html(data.count)
			$(".wxlogo").html("<img src='"+data.wx_avatar+"' style='width:100%;height:100%;border-radius: 50%;'>")
			if(data.state=="1"){
				$("#gorealname").html("审核中");
				$("#gorealname").unbind("click");
			}
			if(data.state=="2"){
				$("#gorealname").html("已实名");
				$("#gorealname").unbind("click");
			}
			if(data.state=="3"){
				$("#gorealname").html("已驳回");
			}
			if(data.type=="0"){
				$("#tg").html("审核中");
				$("#tg").unbind("click");
			}
			if(data.type=="2"){
				$("#tg").html("已驳回");
			}
		}
	})
})


$(".outlogin").click(function(){
    setTimeout(function() {
        //安卓手机
        document.addEventListener(
            "WeixinJSBridgeReady",
            function() {
                WeixinJSBridge.call("closeWindow");
            },
            false
        );
        //ios手机
        WeixinJSBridge.call("closeWindow");
    }, 100);
})